package cn.iocoder.yudao.module.member.dal.mysql.userproblem;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.member.dal.dataobject.userproblem.UserProblemDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.member.controller.admin.userproblem.vo.*;

/**
 * 用户做过的问题 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface UserProblemMapper extends BaseMapperX<UserProblemDO> {

    default PageResult<UserProblemDO> selectPage(UserProblemPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<UserProblemDO>()
                .betweenIfPresent(UserProblemDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(UserProblemDO::getUserId, reqVO.getUserId())
                .eqIfPresent(UserProblemDO::getProblemId, reqVO.getProblemId())
                .eqIfPresent(UserProblemDO::getAnswer, reqVO.getAnswer())
                .eqIfPresent(UserProblemDO::getGreat, reqVO.getGreat())
                .eqIfPresent(UserProblemDO::getBad, reqVO.getBad())
                .eqIfPresent(UserProblemDO::getColl, reqVO.getColl())
                .orderByDesc(UserProblemDO::getId));
    }

}